package com.rg1906.dao.Impl;

import java.sql.SQLException;

import javax.sql.DataSource;

import org.apache.commons.dbutils.QueryRunner;

import com.rg1906.utils.DataSourceC3P0ThreadLocal;

public class UpdateStudentScoreDaoImpl {
	DataSource dataSource = DataSourceC3P0ThreadLocal.getDataSource();
	QueryRunner qr = new QueryRunner(dataSource);
	public int updateChineseScore(String studentNum, String chineseScore) throws SQLException {
		String sql="update t_score set score=? where courseNum=? and studentNum=?";
		Object[] par= {chineseScore,1,studentNum};
		int i1 = qr.update(sql,par);
		return i1;
	}
	public int updateMathScore(String studentNum, String mathScore) throws SQLException {
		String sql="update t_score set score=? where courseNum=? and studentNum=?";
		Object[] par= {mathScore,2,studentNum};
		int i1 = qr.update(sql,par);
		return i1;
	}
	public int updateEnglishScore(String studentNum, String englishScore) throws SQLException {
		String sql="update t_score set score=? where courseNum=? and studentNum=?";
		Object[] par= {englishScore,3,studentNum};
		int i1 = qr.update(sql,par);
		return i1;
	}
	public int updateChemistryScore(String studentNum, String chemistryScore) throws SQLException {
		String sql="update t_score set score=? where courseNum=? and studentNum=?";
		Object[] par= {chemistryScore,4,studentNum};
		int i1 = qr.update(sql,par);
		return i1;
	}
	public int updatePhysicsScore(String studentNum, String physicsScore) throws SQLException {
		String sql="update t_score set score=? where courseNum=? and studentNum=?";
		Object[] par= {physicsScore,5,studentNum};
		int i1 = qr.update(sql,par);
		return i1;
		
	}
	public int updateBiologyScore(String studentNum, String biologyScore) throws SQLException {
		String sql="update t_score set score=? where courseNum=? and studentNum=?";
		Object[] par= {biologyScore,6,studentNum};
		int i1 = qr.update(sql,par);
		return i1;
		
	}
	
}
